package tk.redbluelotto.authentication;

import org.springframework.security.core.GrantedAuthority;

public class GlobalAuthority implements GrantedAuthority {

	private static final long serialVersionUID = 2503804573473605906L;

	private String authority;

	public GlobalAuthority(String authority) {
		this.authority = authority;
	}

	/**
	 * @return the authority
	 */
	public String getAuthority() {
		return authority;
	}

	/**
	 * @param authority
	 *            the authority to set
	 */
	public void setAuthority(String authority) {
		this.authority = authority;
	}

	@Override
	public int hashCode() {
		return authority.hashCode();
	}

	@Override
	public boolean equals(Object obj) {
		if (obj == null)
			return false;
		if (!(obj instanceof GlobalAuthority))
			return false;
		return ((GlobalAuthority) obj).getAuthority().equals(authority);
	}

}
